package com.zxg.zbc.dal.dao.jdbc;



import java.util.Date;

import com.taobao.common.dao.persistence.DBRoute;
import com.zxg.jdbc.CommonJDBCBaseDao;
import com.zxg.zbc.dal.dao.PayServiceItemDao;
import com.zxg.zbc.dal.dao.exception.DAOException;
import com.zxg.zbc.dal.dataobject.PayServiceItem;
import com.zxg.zbc.dal.query.CommonQuery;
/**
 * 为了节省时间 才用jdbc做的
 * @author hd
 *
 */
public class PayServiceItemDaoImpl extends CommonJDBCBaseDao<PayServiceItem> implements PayServiceItemDao{


	

	@Override
	public long insert(PayServiceItem item)
			throws DAOException {
		item.setGmtCreated(new Date());
		item.setGmtModified(new Date());
		long id = this._insert(item);
		return id;
	}

	@Override
	public long update(PayServiceItem item )
			throws DAOException {
		item.setGmtModified(new Date());
		long num = this._update(item);
		
		return num;
	}

	
	@Override
	public CommonQuery<PayServiceItem> query(
			CommonQuery<PayServiceItem> query)
			throws DAOException {
		
		return this.query(query, PayServiceItem.TABLE_NAME, PayServiceItem.class);
	}

	@Override
	public PayServiceItem getById(Long id) throws DAOException {
		String sql = "select * from "+PayServiceItem.TABLE_NAME+" where id = ?";
		try {
			return this.getSingleResult(DBRoute.getAssistantRoute(), PayServiceItem.class,
					sql, id);
		} catch (com.taobao.common.dao.persistence.exception.DAOException e) {
			log.error("error getById ",e);
			throw new DAOException("error getById",e);
		}
	}




	

}
